home *** CD-ROM | disk | FTP | other *** search
- #ifndef CAPI_USR_H
- #define CAPI_USR_H
- /*
- **
- ** $Id: capi-usr.h,v 1.876 1996/08/13 03:10:21 chris Exp $
- **
- ** $Filename: include/capi-usr.h $
- ** $Author: chris $
- ** $Portability: ANSI $
- **
- ** Header file to the CAPI-User interface. This interface makes the
- ** application's calls to the CAPI driver independant from the operating
- ** system running the CAPI. Every supported OS has its own CAPI-User.c
- ** interface file.
- **
- ** No warranty. Use at your own risk.
- **
- ** COPYRIGHT (C) 1993-1996 BY RELOG AG, ZUERICH. ALL RIGHTS RESERVED.
- ** NO PART OF THIS SOFTWARE MAY BE COPIED, REPRODUCED, OR TRANSMITTED
- ** IN ANY FORM OR BY ANY MEANS, WITHOUT THE PRIOR WRITTEN PERMISSION
- ** OF RELOG AG.
- **
- */
-
-
- /*
- ** Maximal length of an ISDN phone number + 1
- */
- #define CAPI_MAX_NUMBER_SIZE (20+1) /* ETS 300-102-1 Page 55 */
-
-
- /*
- ** Macro: Initializes a pointer to the start of the parameter
- ** block of a CAPI message
- ** Example: para = INIT_PARA( msg );
- */
- #define INIT_PARA( msg ) ((unsigned char *)((msg)+1))
-
-
- /*
- ** Macro: Adds an integral parameter to a CAPI message parameter block
- ** and increases the pointer accordin to the parameter's size.
- ** Example: ADD_PARRA( para, U32, myplci );
- */
- #define ADD_PARA( p, t, v ) (*(t *)p = (v), (p) = (void *)((char *)(p) + sizeof(t)))
-
-
- /*
- ** Macro: Gets an integral parameter from a CAPI message parameter block
- ** and increases the pointer accordin to the parameter's size.
- ** Example: GET_PARA( para, U32, plci );
- */
- #define GET_PARA( p, t, v ) ((v) = *(t *)p, (p) = (void *)((char *)(p) + sizeof(t)))
-
-
- /*
- ** Macro: Skips a parameter from a CAPI message parameter block
- ** and increases the pointer accordin to the parameter's size.
- ** Example: SKIP_PARA( para, U32 );
- */
- #define SKIP_PARA( p, t ) ((p) = (void *)((char *)(p) + sizeof(t)))
-
-
- /*
- ** Header of a CAPI message
- */
- typedef struct
- {
- unsigned short TotalLength; /* Length of message including this header */
- unsigned short ApplID; /* Application ID (from CAPI_REGISTER) */
- unsigned char Command; /* Command */
- unsigned char Subcommand; /* Command extension */
- unsigned short MessageNumber; /* Message number */
- } CAPI_MESSAGE;
-
-
- #define CAPI_ICORE_PROFILE_MAGIC 0x1C04 /* For CAPI_ICORE_PROFILE */
-
- /*
- ** Manufacturer specific part of CAPI_PROFILE (20 octets).
- ** Validity of structure elements depends on the Version field.
- */
- typedef struct
- {
- unsigned short Magic; /* CAPI_ICORE_PROFILE_MAGIC */
- unsigned char Version; /* Structure version. Currently 2 */
- unsigned char InterruptNo; /* Interrupt number of this controller */
- unsigned long Address; /* I/O address of this controller */
- unsigned char Flags; /* See PROFILEF_... */
- unsigned char pad[11]; /* Not defined in Version <= 2 */
- } CAPI_ICORE_PROFILE;
-
-
- /*
- ** Flags for CAPI_ICORE_PROFILE.Flags
- */
- #define PROFILE_DPROT_MASK 0x07 /* Mask for D-protocols */
- #define PROFILE_DPROT_Q931 0x01 /* Q.931 signalling in use */
- #define PROFILE_DPROT_1TR6 0x02 /* 1TR6 signalling in use */
- #define PROFILEF_DPROT_AUTO 0x08 /* Auto-detect D-channel protocol */
-
- #define PROFILEF_OVERLAP 0x10 /* Use Overlap Receiving (Durchwahl) */
-
-
- /*
- ** Structure returned by the manufacturer specific command
- ** CAPI_ICORE_GET_STATUS
- */
- typedef struct
- {
- /* Filled in by caller of CAPI_ICORE_GET_STATUS */
- unsigned char ControllerNo; /* Controller number (1..n) */
- unsigned char BChannel; /* B-channel number */
-
- /* Filled in by CAPI_ICORE_GET_STATUS */
- unsigned char Version; /* Structure version. Currently 1 */
- unsigned char pad;
- unsigned short B1Protocol; /* CAPI_B1PROT_... */
- unsigned short B2Protocol; /* CAPI_B2PROT_... */
- unsigned short B3Protocol; /* CAPI_B3PROT_... */
- unsigned short Flags; /* CAPI_ICORE_STATUSF_... */
- unsigned long BytesSent; /* Number of bytes sent so far */
- unsigned long BytesReceived; /* Number of bytes received so far */
- unsigned long ConnectionCost; /* Cost in small currency */
- unsigned char ConnectedNumber[CAPI_MAX_NUMBER_SIZE]; /* Number of other party */
-
- unsigned char pad2[208]; /* Total 256 Bytes */
- } CAPI_ICORE_STATUS;
-
-
- /*
- ** Flags for CAPI_ICORE_STATUS.Flags
- */
- #define CAPI_ICORE_STATUSF_AA 0x0001 /* "Auto Answer", somebody listens on that controller */
- #define CAPI_ICORE_STATUSF_CD 0x0002 /* "Carrier Detect", a connection is active */
- #define CAPI_ICORE_STATUSF_DIR 0x0004 /* Call direction (1 = outgoing) */
- #define CAPI_ICORE_STATUSF_HS 0x0008 /* "High Speed" i.e. not V.110 */
- #define CAPI_ICORE_STATUSF_TR 0x0010 /* "Terminal Ready", somebody listening */
-
-
- /*
- ** Result of CAPI_GET_PROFILE
- */
- typedef struct
- {
- unsigned short NumControllers; /* Number of installed controllers */
- unsigned short NumBChannels; /* Number of supported B-channels */
- unsigned long GlobalOptions; /* See CAPI doc page 139 */
- unsigned long B1Protocols;
- unsigned long B2Protocols;
- unsigned long B3Protocols;
- unsigned long CAPIReserved[6];
- CAPI_ICORE_PROFILE Manufacturer; /* Manufacturer specific data */
- } CAPI_PROFILE;
-
-
- /*
- ** B1 Configuration
- */
- typedef struct
- {
- unsigned short Rate; /* Bit Rate (75 .. 38400) */
- unsigned short BitsLevel; /* Number of data bits (8 or 7) */
- unsigned short Parity; /* 0=none, 1=odd, 2=even */
- unsigned short StopBits; /* 0=1 stop bit, 1=2 stop bits */
- } CAPI_B1_CONFIG;
-
-
- /*
- ** B2 Configuration
- */
- typedef struct
- {
- unsigned char AddressA;
- unsigned char AddressB;
- unsigned char ModuloMode;
- unsigned char WindowSize;
- unsigned char XIDLen;
- /* followed by struct XID */
- } CAPI_B2_CONFIG;
-
-
- /*
- ** B3 Configuration
- */
- typedef struct
- {
- unsigned short LIC;
- unsigned short HIC;
- unsigned short LTC;
- unsigned short HTC;
- unsigned short LOC;
- unsigned short HOC;
- unsigned short ModuloMode;
- unsigned short WindowSize;
- } CAPI_B3_CONFIG_NL;
-
- typedef struct
- {
- unsigned short Resolution;
- unsigned short Format;
- /* Followed by struct station id and struct head line */
- } CAPI_B3_CONFIG_T30;
-
-
-
- /*
- ** CAPI information values and error codes
- */
-
- /* Class 0x00xx: Informative values (corresponding message was processed) */
- #define CAPI_00_REQUEST_ACCEPTED 0
- #define CAPI_00_NCPI_IGNORED 0x0001
- #define CAPI_00_FLAGS_IGNORED 0x0002
- #define CAPI_00_ALERT_SENT_BY_OTHER_APP 0x0003
-
- /* Class 0x10xx: Error information concerning CAPI_REGISTER */
- #define CAPI_10_TOO_MANY_APPLICATIONS 0x1001
- #define CAPI_10_BLOCK_SIZE_TOO_SMALL 0x1002
- #define CAPI_10_BUFFER_TOO_LARGE 0x1003
- #define CAPI_10_BUFFER_TOO_SMALL 0x1004
- #define CAPI_10_TOO_MANY_CONNECTIONS 0x1005
- #define CAPI_10_reserved1006 0x1006
- #define CAPI_10_INTERNAL_BUSY 0x1007
- #define CAPI_10_OS_RESOURCE_ERROR 0x1008
- #define CAPI_10_CAPI_NOT_INSTALLED 0x1009
- #define CAPI_10_EXTERNAL_NOT_SUPPORTED 0x100A
- #define CAPI_10_ONLY_EXTERNAL_SUPPORTED 0x100B
-
- /* Class 0x11xx: Error information concerning message exchange functions */
- #define CAPI_11_ILLEGAL_APPLID 0x1101
- #define CAPI_11_ILLEGAL_MESSAGE 0x1102
- #define CAPI_11_MESSAGE_NOT_ACCEPTED 0x1103
- #define CAPI_11_MESSAGE_QUEUE_EMPTY 0x1104
- #define CAPI_11_MESSAGE_QUEUE_OVERFLOW 0x1105
- #define CAPI_11_UNKNOWN_NOTIFICATION_PARAMETER 0x1106
- #define CAPI_11_INTERNAL_BUSY 0x1107
- #define CAPI_11_OS_RESOURCE_ERROR 0x1108
- #define CAPI_11_EXTERNAL_NOT_SUPPORTED 0x110A
- #define CAPI_11_ONLY_EXTERNAL_SUPPORTED 0x110B
-
- /* Class 0x20xx: Error information concerning resource / coding problems */
- #define CAPI_20_MSG_UNSUPPORTED_IN_STATE 0x2001
- #define CAPI_20_ILLEGAL_CONTROLLER 0x2002 /* 3x */
- #define CAPI_20_ILLEGAL_PLCI 0x2002 /* 3x */
- #define CAPI_20_ILLEGAL_NCCI 0x2002 /* 3x */
- #define CAPI_20_OUT_OF_PLCI 0x2003
- #define CAPI_20_OUT_OF_NCCI 0x2004
- #define CAPI_20_OUT_OF_LISTEN 0x2005
- #define CAPI_20_OUT_OF_FAX_RESOURCES 0x2006
- #define CAPI_20_ILLEGAL_PARAMETER_CODING 0x2007
-
- /* Class 0x30xx: Error information concerning requested services */
- #define CAPI_30_B1_PROTOCOL_NOT_SUPPORTED 0x3001
- #define CAPI_30_B2_PROTOCOL_NOT_SUPPORTED 0x3002
- #define CAPI_30_B3_PROTOCOL_NOT_SUPPORTED 0x3003
- #define CAPI_30_B1_PARAMETER_NOT_SUPPORTED 0x3004
- #define CAPI_30_B2_PARAMETER_NOT_SUPPORTED 0x3005
- #define CAPI_30_B3_PARAMETER_NOT_SUPPORTED 0x3006
- #define CAPI_30_B_PROTOCOL_COMBINATION_NOT_SUPPORTED 0x3007
- #define CAPI_30_NCPI_NOT_SUPPORTED 0x3008
- #define CAPI_30_CIP_VALUE_UNKNOWN 0x3009
- #define CAPI_30_FLAGS_NOT_SUPPORTED 0x300A
- #define CAPI_30_FACILITY_NOT_SUPPORTED 0x300B
- #define CAPI_30_DATA_LENGTH_NOT_SUPPORTED 0x300C
- #define CAPI_30_RESET_PROCEDURE_NOT_SUPPORTED 0x300D
-
- /* Class 0x33xx: Reason */
- #define CAPI_33_PROTOCOL_ERROR_L1 0x3301
- #define CAPI_33_PROTOCOL_ERROR_L2 0x3302
- #define CAPI_33_PROTOCOL_ERROR_L3 0x3303
-
- /* Class 0x34xx */
- #define CAPI_34_ANOTHER_APPLICATION_GOT_THE_CALL 0x3404
-
-
- /*
- ** Message types for CAPI_MESSAGE->Command
- */
-
- /* Signalling messages */
- #define CAPICMD_ALERT 0x01
- #define CAPICMD_CONNECT 0x02
- #define CAPICMD_CONNECT_ACTIVE 0x03
- #define CAPICMD_DISCONNECT 0x04
- #define CAPICMD_INFO 0x08
-
- /* Messages concerning logical connections */
- #define CAPICMD_CONNECT_B3 0x82
- #define CAPICMD_CONNECT_B3_ACTIVE 0x83
- #define CAPICMD_DISCONNECT_B3 0x84
- #define CAPICMD_DATA_B3 0x86
- #define CAPICMD_RESET_B3 0x87
- #define CAPICMD_CONNECT_B3_T90_ACTIVE 0x88
-
- /* Administrative and other messages */
- #define CAPICMD_LISTEN 0x05
- #define CAPICMD_SELECT_B_PROTOCOL 0x41
- #define CAPICMD_FACILITY 0x80
- #define CAPICMD_MANUFACTURER 0xFF
-
-
- /*
- ** Subcommands for CAPI_MESSAGE->Subcommand
- */
- #define CAPISUBCMD_REQ 0x80
- #define CAPISUBCMD_CONF 0x81
- #define CAPISUBCMD_IND 0x82
- #define CAPISUBCMD_RESP 0x83
-
-
- /*
- ** CIP values (CONNECT_REQ, CONNECT_IND)
- */
- #define CAPI_CIP_NONE 0 /* No predefined profile */
- #define CAPI_CIP_SPEECH 1 /* Speech */
- #define CAPI_CIP_DATA 2 /* Unrestricted digital information */
- #define CAPI_CIP_RESTRICTED_DATA 3 /* Restricted digital information */
- #define CAPI_CIP_AUDIO31 4 /* 3.1 kHz audio */
- #define CAPI_CIP_AUDIO7 5 /* 7 kHz audio */
- #define CAPI_CIP_VIDEO 6 /* Video */
- #define CAPI_CIP_PACKET 7 /* Packet mode */
- #define CAPI_CIP_RA56 8 /* 56 kBit/s rate adaption */
- #define CAPI_CIP_DATA_TONES 9 /* Unrestricted digital information w/ tones/announcements */
- #define CAPI_CIP_TELEPHONY 16 /* Telephony */
- #define CAPI_CIP_FAX3 17 /* Facsimile group 2/3 */
- #define CAPI_CIP_FAX4 18 /* Facsimile group 4 class 1 */
- #define CAPI_CIP_19 19 /* See capi20 doc page 74 */
- #define CAPI_CIP_20 20 /* Teletex service basic and processable mode */
- #define CAPI_CIP_21 21 /* Teletex service basic mode */
- #define CAPI_CIP_VIDEOTEX 22 /* International interworking for videotex */
- #define CAPI_CIP_TELEX 23 /* Telex */
- #define CAPI_CIP_X400 24 /* Message Handling Systems according to X.400 */
- #define CAPI_CIP_X200 25 /* OSI application according to X.200 */
- #define CAPI_CIP_TELEPHONY7 26 /* 7 kHz Telephony */
- #define CAPI_CIP_VIDEOTEL1 27 /* Video telephony, first connection */
- #define CAPI_CIP_VIDEOTEL2 28 /* Video telephony, second connection */
-
-
- /*
- ** Bits for Info mask (LISTEN_REQ)
- */
- #define CAPI_INFO_CAUSE 0x00000001
- #define CAPI_INFO_DATETIME 0x00000002
- #define CAPI_INFO_DISPLAY 0x00000004
- #define CAPI_INFO_USERUSER 0x00000008
- #define CAPI_INFO_CALLPROGRESSION 0x00000010
- #define CAPI_INFO_FACILITY 0x00000020
- #define CAPI_INFO_CHARGING 0x00000040
-
-
- /*
- ** Values for Reject (CONNECT_RESP and CONNECT_B3_RESP)
- */
- #define CAPI_REJECT_ACCEPT 0x0000 /* Accept call */
- #define CAPI_REJECT_IGNORE 0x0001 /* Ignore call */
- #define CAPI_REJECT_NORMAL 0x0002 /* Reject call, normal call clearing */
- #define CAPI_REJECT_BUSY 0x0003 /* Reject call, user busy */
- #define CAPI_REJECT_NOCHANNEL 0x0004 /* Reject call, requested circuit/channel n/a */
- #define CAPI_REJECT_FACILITY 0x0005 /* Reject call, facility rejected */
- #define CAPI_REJECT_CHANNEL 0x0006 /* Reject call, channel unacceptable */
- #define CAPI_REJECT_INCOMPATIBLE 0x0007 /* Reject call, incompatible destination */
- #define CAPI_REJECT_DESTOUTOFORDER 0x0008 /* Reject call, destination out of order */
-
-
- /*
- ** B1 protocols (CAPI 2.0 p. 66ff)
- */
- #define CAPI_B1PROT_HDLC64 0 /* 64kBit/s with HDLC framing (default) */
- #define CAPI_B1PROT_TRANSP64 1 /* 64kBit/s transparent */
- #define CAPI_B1PROT_V110ASYNC 2 /* V.110 async with start/stop byte framing */
- #define CAPI_B1PROT_V110SYNC 3 /* V.110 synchronous with HDLC framing */
- #define CAPI_B1PROT_T30 4 /* T.30 modem for fax group 3 */
- #define CAPI_B1PROT_HDLCI64 5 /* 64kBit/s inverted with HDCL framing */
- #define CAPI_B1PROT_TRANSP56 6 /* 56kBit/s transparent */
-
-
- /*
- ** B2 protocols
- */
- #define CAPI_B2PROT_X75 0 /* ISO 7776 / X.75 SLP (default) */
- #define CAPI_B2PROT_TRANSP 1 /* Transparent */
- #define CAPI_B2PROT_SDLC 2 /* SDLC */
- #define CAPI_B2PROT_LAPD 3 /* LAPD according Q.921 for D-channel X.25 */
- #define CAPI_B2PROT_T30 4 /* T.30 for fax group 3 */
- #define CAPI_B2PROT_PPP 5 /* Point to Point Protocol (PPP) */
- #define CAPI_B2PROT_XTRANSP 6 /* Transparent (ignoring B1 framing errors) */
-
-
- /*
- ** B3 protocols
- */
- #define CAPI_B3PROT_TRANSP 0 /* Transparent (default) */
- #define CAPI_B3PROT_T90 1 /* T.90 network layer (compatible to T.70) */
- #define CAPI_B3PROT_ISO8208 2 /* ISO 8208 (X.25 DTE-DTE) */
- #define CAPI_B3PROT_X25DCE 3 /* X.25 DCE */
- #define CAPI_B3PROT_T30 4 /* T.30 for fax group 3 */
-
-
- /*
- ** Function codes
- */
- #define CAPI_FC_REGISTER 0x01
- #define CAPI_FC_RELEASE 0x02
- #define CAPI_FC_PUT_MESSAGE 0x03
- #define CAPI_FC_GET_MESSAGE 0x04
- #define CAPI_FC_SET_SIGNAL 0x05
- #define CAPI_FC_DEINSTALL 0x06 /* CAPI 1.1 only */
- #define CAPI_FC_GET_MANUFACTURER 0xF0
- #define CAPI_FC_GET_VERSION 0xF1
- #define CAPI_FC_GET_SERIAL_NUMBER 0xF2
- #define CAPI_FC_GET_PROFILE 0xF3
- #define CAPI_FC_MANUFACTURER 0xFF
-
-
- /*
- ** PLCI State Machine (page 94)
- */
-
- #define P0_IDLE 0 /* We are idle */
- #define P01_CONNECT_REQUEST 101 /* Sent CONNECT_REQ */
- #define P1_CONNECT_CONFIRM 1 /* Got CONNECT_CONF */
- #define P2_CONNECT_INDICATION 2 /* Got CONNECT_IND */
- #define P3 3 /* Handset things */
- #define P4_CALL_ACCEPTED 4 /* Sent CONNECT_RESP(accept) */
- #define P5_DISCONNECT_REQUEST 5 /* Sent DISCONNECT_REQ or CONNECT_RESP(reject) */
- #define P6_DISCONNECT_INDICATION 6 /* Got DISCONNECT_IND */
- #define P_ACTIVE 10 /* Got CONNECT_ACTIVE_IND */
-
-
- /*
- ** NCCI State Machine (page 96)
- */
-
- #define N0_IDLE 0 /* Nada */
- #define N01_CONNECT_REQUEST 101 /* Sent CONNECT_B3_REQ */
- #define N1_CONNECT_INDICATION 1 /* Got CONNECT_B3_IND */
- #define N2_CONNECT_INITIATED 2 /* Got CONNECT_B3_CONF or RESP */
- #define N3_RESET_REQUEST 3 /* Sent RESET_B3_REQ */
- #define N4_DISCONNECT_REQUEST 4 /* Sent DISCONNECT_B3_REQ or CONNECT_B3_RESP(reject) */
- #define N5_DISCONNECT_INDICATION 5 /* Got DISCONNECT_B3_IND */
- #define N_ACTIVE 10 /* Got CONNECT_B3_ACTIVE_IND */
-
-
- /*
- ** Prototypes for the OS-independant CAPI abstraction layer (CAPI-Usr.c)
- */
-
- unsigned
- U_CAPI_REGISTER( unsigned, unsigned, unsigned, unsigned short * );
-
- unsigned
- U_CAPI_RELEASE( unsigned short );
-
- unsigned
- U_CAPI_PUT_MESSAGE( unsigned short, CAPI_MESSAGE * );
-
- unsigned
- U_CAPI_GET_MESSAGE( unsigned short, CAPI_MESSAGE ** );
-
- unsigned short
- U_CAPI_SET_SIGNAL( unsigned short, unsigned long, unsigned long );
-
- void
- U_CAPI_GET_MANUFACTURER( char * );
-
- void
- U_CAPI_GET_VERSION( unsigned long * );
-
- void
- U_CAPI_GET_SERIAL_NUMBER( char * );
-
- unsigned
- U_CAPI_GET_PROFILE( CAPI_PROFILE *, unsigned short );
-
- unsigned
- U_CAPI_INSTALLED( void );
-
- #endif
-